import request from '@/utils/request'

const prefix = '/upms/role'

export default {

  create(data) {
    return request({
      url: `${prefix}/create`,
      method: 'post',
      data
    })
  },

  update(data) {
    return request({
      url: `${prefix}/update`,
      method: 'post',
      data
    })
  },

  delete(id) {
    return request({
      url: `${prefix}/delete/${id}`,
      method: 'post'
    })
  },

  page(data) {
    return request({
      url: `${prefix}/page`,
      method: 'post',
      data
    })
  },
  getRoleRouters(roleId) {
    return request({
      url: `${prefix}/list/routers/${roleId}`,
      method: 'get'
    })
  },
  saveRoleRouters(data) {
    return request({
      url: `${prefix}/save/routers/${data.roleId}`,
      method: 'post',
      data: data.checkedIds
    })
  }
}
